/*
 * Sonatype Nexus (TM) Open Source Version
 * Copyright (c) 2008-present Sonatype, Inc.
 * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
 *
 * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
 * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
 *
 * Sonatype Nexus (TM) Open Source Version is distributed with Sencha Ext JS pursuant to a FLOSS Exception agreed upon
 * between Sonatype, Inc. and Sencha Inc. Sencha Ext JS is licensed under GPL v3 and cannot be redistributed as part of a
 * closed source work.
 *
 * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
 * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
 * Eclipse Foundation. All other trademarks are the property of their respective owners.
 */
export const TASKS = [
  {
    alertEmail: 'test@test.test',
    cronExpression: '0 0 1 * * ?',
    enabled: true,
    id: '6f7a90b5-eb15-443c-b2ea-f8ff5ad458b1',
    lastRun: '2023-03-21T03:32:02.129+01:00',
    lastRunResult: 'Ok [0s]',
    name: 'Cleanup service',
    nextRun: '2023-03-18T01:00:00.000+01:00',
    notificationCondition: 'SUCCESS_FAILURE',
    properties: {
      '.created': '2023-03-17T11:42:57.557+01:00',
      '.exposed': 'false',
      '.id': '6f7a90b5-eb15-443c-b2ea-f8ff5ad458b1',
      '.name': 'Cleanup service',
      '.recoverable': 'false',
      '.typeId': 'repository.cleanup',
      '.typeName': 'Admin - Cleanup repositories using their associated policies',
      '.updated': '2023-03-17T11:42:57.557+01:00',
      '.visible': 'true',
    },
    recurringDays: null,
    runnable: true,
    schedule: 'advanced',
    startDate: '2023-03-17T11:42:57.557+01:00',
    status: 'WAITING',
    statusDescription: 'Waiting',
    stoppable: false,
    timeZoneOffset: null,
    typeId: 'repository.cleanup',
    typeName: 'Admin - Cleanup repositories using their associated policies',
  },
  {
    alertEmail: null,
    cronExpression: null,
    enabled: true,
    id: 'faf58f23-d5e8-4932-b775-0460ade7e9d2',
    lastRun: '2023-03-17T12:45:00.004+01:00',
    lastRunResult: 'Error [0s]',
    name: 'a-task-script-1',
    nextRun: '2023-03-17T13:45:00.000+01:00',
    notificationCondition: 'FAILURE',
    properties: {
      '.created': '2023-03-17T12:14:59.854+01:00',
      '.enabled': 'true',
      '.exposed': 'true',
      '.id': 'faf58f23-d5e8-4932-b775-0460ade7e9d2',
      '.message': 'Execute script',
      '.name': 'a-task-script-1',
      '.notificationCondition': 'FAILURE',
      '.recoverable': 'false',
      '.typeId': 'script',
      '.typeName': 'Admin - Execute script',
      '.updated': '2023-03-17T12:14:59.854+01:00',
      '.visible': 'true',
    },
    language: 'groovy',
    'lastRunState.endState': 'FAILED',
    'lastRunState.runDuration': '844',
    'lastRunState.runStarted': '1679053500004',
    source: 'run name',
    recurringDays: null,
    runnable: true,
    schedule: 'hourly',
    startDate: '2023-03-17T00:45:00.000+01:00',
    status: 'WAITING',
    statusDescription: 'Waiting',
    stoppable: false,
    timeZoneOffset: null,
    typeId: 'script',
    typeName: 'Admin - Execute script',
  },
  {
    alertEmail: 'test@test.test',
    cronExpression: null,
    enabled: true,
    id: '0e07e516-e1b9-49b3-ac60-f52507fbec6c',
    lastRun: '2023-03-17T13:38:27.427+01:00',
    lastRunResult: 'Ok [0s]',
    name: 'a-task-cleanup-tags-1',
    nextRun: null,
    notificationCondition: 'SUCCESS_FAILURE',
    properties: {
      '.alertEmail': 'test@ex.com',
      '.created': '2023-03-17T12:13:16.651+01:00',
      '.enabled': 'true',
      '.exposed': 'true',
      '.id': '0e07e516-e1b9-49b3-ac60-f52507fbec6c',
      '.message': 'Cleanup tags based on specified criteria',
      '.name': 'a-task-cleanup-tags-1',
      '.notificationCondition': 'SUCCESS_FAILURE',
      '.recoverable': 'false',
      '.typeId': 'tags.cleanup',
      '.typeName': 'Admin - Cleanup tags',
      '.updated': '2023-03-17T12:13:16.651+01:00',
      '.visible': 'true',
    },
    deleteAssociatedComponents: 'false',
    firstCreatedDays: '0',
    'lastRunState.endState': 'OK',
    'lastRunState.runDuration': '82',
    'lastRunState.runStarted': '1679056707427',
    lastUpdatedDays: '0',
    restrictComponentDelete: 'maven-proxy',
    recurringDays: null,
    runnable: true,
    schedule: 'manual',
    startDate: null,
    status: 'WAITING',
    statusDescription: 'Waiting',
    stoppable: false,
    timeZoneOffset: null,
    typeId: 'tags.cleanup',
    typeName: 'Admin - Cleanup tags',
  },
  {
    alertEmail: 'test@m.com',
    cronExpression: null,
    enabled: true,
    id: 'd3275dbe-c784-47f1-8ea2-338088f7ceab',
    lastRun: '2023-03-21T03:32:02.129+01:00',
    lastRunResult: 'Ok [0s]',
    name: 'a-task-delete-blob-store-files-1',
    nextRun: '2023-03-31T01:30:00.000+02:00',
    notificationCondition: 'SUCCESS_FAILURE',
    properties: {
      '.alertEmail': 'test@m.com',
      '.created': '2023-03-17T12:17:48.600+01:00',
      '.enabled': 'true',
      '.exposed': 'true',
      '.id': 'd3275dbe-c784-47f1-8ea2-338088f7ceab',
      '.name': 'a-task-delete-blob-store-files-1',
      '.notificationCondition': 'SUCCESS_FAILURE',
      '.recoverable': 'false',
      '.typeId': 'blobstore.delete-temp-files',
      '.typeName': 'Admin - Delete blob store temporary files',
      '.updated': '2023-03-17T12:17:48.600+01:00',
      '.visible': 'true',
    },
    blobstoreName: 'a-file-1',
    recurringDays: [2, 17, 999],
    runnable: true,
    schedule: 'monthly',
    startDate: '2023-03-17T01:30:00.000+01:00',
    status: 'WAITING',
    statusDescription: 'Waiting',
    stoppable: false,
    timeZoneOffset: null,
    typeId: 'blobstore.delete-temp-files',
    typeName: 'Admin - Delete blob store temporary files',
  },
];

export const TASKS_TYPES = [
  {
    concurrentRun: true,
    exposed: true,
    id: 'blobstore.delete-temp-files',
    name: 'Admin - Delete blob store temporary files',
    formFields: [
      {
        allowAutocomplete: false,
        attributes: {},
        disabled: false,
        helpText: 'Select the blob store to delete temporary files',
        id: 'blobstoreName',
        idMapping: 'name',
        initialValue: null,
        label: 'Blob store',
        maxValue: null,
        minValue: null,
        nameMapping: null,
        readOnly: false,
        regexValidation: null,
        required: true,
        storeApi: 'coreui_Blobstore.read',
        storeFilters: null,
        type: 'combobox',
      },
    ],
  },
  {
    concurrentRun: true,
    exposed: false,
    formFields: [],
    id: 'assetBlob.cleanup',
    name: 'Admin - Cleanup unused asset blobs',
  },
  {
    concurrentRun: true,
    exposed: true,
    id: 'repository.yum.rebuild.metadata',
    name: 'Repair - Rebuild Yum repository metadata (repodata)',
    formFields: [
      {
        allowAutocomplete: true,
        attributes: {},
        disabled: false,
        helpText: 'Select the Yum repository to rebuild metadata for',
        id: 'repositoryName',
        idMapping: null,
        initialValue: null,
        label: 'Repository',
        maxValue: null,
        minValue: null,
        nameMapping: null,
        readOnly: false,
        regexValidation: null,
        required: true,
        storeApi: 'coreui_Repository.readReferences',
        type: 'combobox',
        storeFilters: {
          format: 'yum',
          type: 'hosted',
        }
      },
      {
        allowAutocomplete: false,
        attributes: {},
        disabled: false,
        helpText: 'Only update the metadata with RPM changes since the last metadata generation',
        id: 'yumMetadataCaching',
        idMapping: null,
        initialValue: null,
        label: 'Soft repair',
        maxValue: null,
        minValue: null,
        nameMapping: null,
        readOnly: false,
        regexValidation: null,
        required: false,
        storeApi: null,
        storeFilters: null,
        type: 'checkbox',
      },
    ],
  },
  {
    concurrentRun: true,
    exposed: true,
    id: 'blobstore.compact',
    name: 'Admin - Compact blob store',
    formFields: [
      {
        allowAutocomplete: false,
        attributes: {},
        disabled: false,
        helpText: 'Select the blob store to compact',
        id: 'blobstoreName',
        idMapping: 'name',
        initialValue: null,
        label: 'Blob store',
        maxValue: null,
        minValue: null,
        nameMapping: null,
        readOnly: false,
        regexValidation: null,
        required: true,
        storeApi: 'coreui_Blobstore.read',
        storeFilters: null,
        type: 'combobox',
      },
    ],
  },
  {
    concurrentRun: true,
    exposed: true,
    formFields: [],
    id: 'repository.vulnerability.statistics',
    name: 'Statistics - recalculate vulnerabilities statistics',
  },
];
